<?php
class Silk_Mapi_Helper_Cache extends Mage_Core_Helper_Abstract
{
	public function updateProduct($product)
	{
        return;
		$_imageHelper = Mage::helper('catalog/image');
		$_redis = Mage::helper('mapi')->getRedis();
        if(!$_redis) return;
		$data = array();
    	$data['id'] = $product->getId();
    	$data['name'] = $product->getName();
    	$data['price'] = Mage::helper('checkout')->formatPrice($product->getPrice());
    	$data['final_price'] = Mage::helper('checkout')->formatPrice($product->getFinalPrice());
    	$data['image'] = $_imageHelper->init($product,'small_image')->resize(300)."";
    	$images = array();
    	$gallery = $product->getMediaGalleryImages();
    	foreach($gallery as $image)
    	{
    		$images[] = $image->getUrl();
    	}
    	$data['images'] = $images;
    	$data['description'] = $product->getShortDescription();
    	$_redis->hSet('products',$product->getId(),Zend_Json::encode($data));
        Mage::log('cache product '.$product->getId());
	}
}
	 